package com.atde._04_structural_design_patterns.composite;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.composite
 * @Author: Del
 * @CreateTime: 2025-06-23  00:35
 * @Description: 组合模式  --- 抽象组织
 * @Version: 1.0
 */
public abstract class OrganizationComponent {

    private String name;
    private String desc;

    public OrganizationComponent(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    // 添加方法，提供默认实现
    protected void add(OrganizationComponent organizationComponent) {
        throw new UnsupportedOperationException();
    }

    // 移除方法，提供默认实现
    protected void remove(OrganizationComponent organizationComponent) {
        throw new UnsupportedOperationException();
    }

    // 抽象方法，所有子类都要实现，打印信息
    protected abstract void print();
}
